package com.cdc.baserecyclerviewadapterhelper.adapter;

import androidx.annotation.Nullable;
import com.cdc.baserecyclerviewadapterhelper.R;
import com.cdc.baserecyclerviewadapterhelper.entity.HomeEntity;
import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import java.util.List;

public class HomeAdapter extends BaseSectionQuickAdapter<HomeEntity, BaseViewHolder>{
    public HomeAdapter(List<HomeEntity> data) {
        super(R.layout.def_section_head, R.layout.home_item_view, data);
    }

    @Override
    protected void convertHeader( BaseViewHolder baseViewHolder,  HomeEntity homeEntity) {
        baseViewHolder.setGone(R.id.more, true);
        baseViewHolder.setText(R.id.header, homeEntity.getHeaderTitle());
    }

    @Override
    protected void convert( BaseViewHolder baseViewHolder, HomeEntity homeEntity) {
        baseViewHolder.setText(R.id.text, homeEntity.getName());
        baseViewHolder.setImageResource(R.id.icon, homeEntity.getImageResource());
    }
}
